package com.myersinfosys.protrack.poi;

public class PoiExcelRead {

    public static void main(String[] args) throws Exception {
    	final Boolean isTest = true;
    	String xlsfilename = ".//data//data.xls";
    	String outfilebase = ".//data//test";
    	
    	if (args.length == 2 || isTest) { 
    		if (args.length == 2) {
    			xlsfilename = args[0];
    			outfilebase = args[1];
    		}
    		
    		XLSReader xls = new XLSReader(xlsfilename);
    		if(xls.hasData) {
    			xls.writeUnlData(outfilebase + ".unl");
    			xls.writeSqlCreate(outfilebase + ".sql");
    		} else {
    			System.out.println("No data, or file cannot be read.");
    		}
    	} else {
    		System.out.println("Usage:");
    		System.out.println("java PoiExcelRead xlsfilename outfilebase");
    		System.out.println("Ex: java PoiExcelRead /tmp/data.xls /tmp/test");
    	}
    		
    }
}
